package LeetCode.month01.day01;

import java.util.Scanner;

public class No11 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] chs = s.split(",");
        int[] a = new int[chs.length];
        for (int i = 0; i < chs.length; i++) {
            a[i] = chs[i].charAt(0)-'0';
        }
//        System.out.println(a);
        System.out.println(maxArea(a));
    }

    public static int maxArea(int[] height) {
        int left= 0,right=height.length-1;
        int sum = 0;
        while(right>left){
            if(height[left]>height[right]){
                sum = Math.max(sum,height[right]*(right-left));
                right--;
            }else{
                sum = Math.max(sum,height[left]*(right-left));
                left++;
            }
        }
        return sum;
    }
}
